project(yolov8ncnn)

cmake_minimum_required(VERSION 3.10)

message("----------------------------------------")
message(${CMAKE_CURRENT_SOURCE_DIR})
message("----------------------------------------")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") # 他需要用到 C++11特下

set(OpenCV_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/include)
set(NCNN_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/include)
set(jniLibDir ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/libs)

include_directories(${OpenCV_DIR})
add_library(opencv_java4 SHARED IMPORTED)
set_target_properties(opencv_java4 PROPERTIES IMPORTED_LOCATION
${jniLibDir}/${CMAKE_ANDROID_ARCH_ABI}/libopencv_java4.so)


include_directories(${NCNN_DIR})
add_library(ncnn SHARED IMPORTED)
set_target_properties(ncnn PROPERTIES IMPORTED_LOCATION
        ${jniLibDir}/${CMAKE_ANDROID_ARCH_ABI}/libncnn.so)
aux_source_directory(. SOURCE)

add_library(yolov8ncnn SHARED ${SOURCE})

target_link_libraries(yolov8ncnn log android camera2ndk mediandk ncnn opencv_java4)
